namespace InventoryManagement
{
	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.ComponentModel;
	using System.Data;
	using System.Data.SqlClient;
	using System.Text;
	
	
	public class Data_Cabang : BaseTable
	{
		
		#region Static SQL String Members
		/// <remarks>This field represents the full SELECT string for the table Data Cabang, with the WHERE clause.</remarks>
        internal static string _SQL_Select = @"SELECT [ID], [wfStatus], [ID_Router], [ID_NAS], [ID_Provider], [NamaCabang], [KodeCabang], [NamaLokasi], [Alamat], [SerialNumber], [IPLAN], [Bandwidth], [NamaNAS], [IPWAN], [IPNAS], [JumlahPC], [JumlahNotebook], [JumlahTC], [Date], [PIC], [Telp], [HP], [Engineer], [SID], [KodeCabang] + ' - ' + [NamaCabang] + ' - ' + [NamaLokasi] as Lokasi FROM [dbo].[Data Cabang] WHERE [ID]=@ID ";
		
		/// <remarks>This field represents the full SELECT string for the table Data Cabang, with the WHERE clause.</remarks>
        internal static string _SQL_SelectByParam = "SELECT [ID], [wfStatus], [ID_Router], [ID_NAS], [ID_Provider], [NamaCabang], [KodeCabang], [NamaLokasi], [Alamat], [SerialNumber], [IPLAN], [Bandwidth], [NamaNAS], [IPWAN], [IPNAS], [JumlahPC], [JumlahNotebook], [JumlahTC], [Date], [PIC], [Telp], [HP], [Engineer], [SID], [KodeCabang] + ' - ' + [NamaCabang] + ' - ' + [NamaLokasi] as Lokasi FROM [dbo].[Data Cabang] WHERE isnull(convert(varchar(36),[ID]),\'true\')=isnull(convert(varchar(36),@ID),isnull(convert(varchar(36),[ID]),\'true\')) AND isnull(convert(varchar,[wfStatus]),\'true\')=isnull(convert(varchar,@wfStatus),isnull(convert(varchar,[wfStatus]),\'true\')) AND isnull(convert(varchar(36),[ID_Router]),\'true\')=isnull(convert(varchar(36),@ID_Router),isnull(convert(varchar(36),[ID_Router]),\'true\')) AND isnull(convert(varchar(36),[ID_NAS]),\'true\')=isnull(convert(varchar(36),@ID_NAS),isnull(convert(varchar(36),[ID_NAS]),\'true\')) AND isnull(convert(varchar(36),[ID_Provider]),\'true\')=isnull(convert(varchar(36),@ID_Provider),isnull(convert(varchar(36),[ID_Provider]),\'true\')) AND isnull(convert(varchar,[NamaCabang]),\'true\')=isnull(convert(varchar,@NamaCabang),isnull(convert(varchar,[NamaCabang]),\'true\')) AND isnull(convert(varchar,[KodeCabang]),\'true\')=isnull(convert(varchar,@KodeCabang),isnull(convert(varchar,[KodeCabang]),\'true\')) AND isnull(convert(varchar,[NamaLokasi]),\'true\')=isnull(convert(varchar,@NamaLokasi),isnull(convert(varchar,[NamaLokasi]),\'true\')) AND isnull(convert(varchar,[Alamat]),\'true\')=isnull(convert(varchar,@Alamat),isnull(convert(varchar,[Alamat]),\'true\')) AND isnull(convert(varchar,[SerialNumber]),\'true\')=isnull(convert(varchar,@SerialNumber),isnull(convert(varchar,[SerialNumber]),\'true\')) AND isnull(convert(varchar,[IPLAN]),\'true\')=isnull(convert(varchar,@IPLAN),isnull(convert(varchar,[IPLAN]),\'true\')) AND isnull(convert(varchar,[Bandwidth]),\'true\')=isnull(convert(varchar,@Bandwidth),isnull(convert(varchar,[Bandwidth]),\'true\')) AND isnull(convert(varchar,[NamaNAS]),\'true\')=isnull(convert(varchar,@NamaNAS),isnull(convert(varchar,[NamaNAS]),\'true\')) AND isnull(convert(varchar,[IPWAN]),\'true\')=isnull(convert(varchar,@IPWAN),isnull(convert(varchar,[IPWAN]),\'true\')) AND isnull(convert(varchar,[IPNAS]),\'true\')=isnull(convert(varchar,@IPNAS),isnull(convert(varchar,[IPNAS]),\'true\')) AND isnull(convert(varchar,[JumlahPC]),\'true\')=isnull(convert(varchar,@JumlahPC),isnull(convert(varchar,[JumlahPC]),\'true\')) AND isnull(convert(varchar,[JumlahNotebook]),\'true\')=isnull(convert(varchar,@JumlahNotebook),isnull(convert(varchar,[JumlahNotebook]),\'true\')) AND isnull(convert(varchar,[JumlahTC]),\'true\')=isnull(convert(varchar,@JumlahTC),isnull(convert(varchar,[JumlahTC]),\'true\')) AND isnull(convert(varchar,[Date]),\'true\')=isnull(convert(varchar,@Date),isnull(convert(varchar,[Date]),\'true\')) AND isnull(convert(varchar,[PIC]),\'true\')=isnull(convert(varchar,@PIC),isnull(convert(varchar,[PIC]),\'true\')) AND isnull(convert(varchar,[Telp]),\'true\')=isnull(convert(varchar,@Telp),isnull(convert(varchar,[Telp]),\'true\')) AND isnull(convert(varchar,[HP]),\'true\')=isnull(convert(varchar,@HP),isnull(convert(varchar,[HP]),\'true\')) AND isnull(convert(varchar,[Engineer]),\'true\')=isnull(convert(varchar,@Engineer),isnull(convert(varchar,[Engineer]),\'true\')) AND isnull(convert(varchar,[SID]),\'true\')=isnull(convert(varchar,@SID),isnull(convert(varchar,[SID]),\'true\')) ";
		
		/// <remarks>This field represents the full INSERT INTO string for the table Data Cabang.</remarks>
		internal static string _SQL_Insert = @"INSERT INTO [dbo].[Data Cabang] ([ID], [wfStatus], [ID_Router], [ID_NAS], [ID_Provider], [NamaCabang], [KodeCabang], [NamaLokasi], [Alamat], [SerialNumber], [IPLAN], [Bandwidth], [NamaNAS], [IPWAN], [IPNAS], [JumlahPC], [JumlahNotebook], [JumlahTC], [Date], [PIC], [Telp], [HP], [Engineer], [SID]) VALUES(@ID, @wfStatus, @ID_Router, @ID_NAS, @ID_Provider, @NamaCabang, @KodeCabang, @NamaLokasi, @Alamat, @SerialNumber, @IPLAN, @Bandwidth, @NamaNAS, @IPWAN, @IPNAS, @JumlahPC, @JumlahNotebook, @JumlahTC, @Date, @PIC, @Telp, @HP, @Engineer, @SID) ";
		
		/// <remarks>This field represents the full UPDATE string for the table Data Cabang, with the WHERE clause.</remarks>
		internal static string _SQL_Update = @"UPDATE [dbo].[Data Cabang] SET [ID] = @ID, [wfStatus] = @wfStatus, [ID_Router] = @ID_Router, [ID_NAS] = @ID_NAS, [ID_Provider] = @ID_Provider, [NamaCabang] = @NamaCabang, [KodeCabang] = @KodeCabang, [NamaLokasi] = @NamaLokasi, [Alamat] = @Alamat, [SerialNumber] = @SerialNumber, [IPLAN] = @IPLAN, [Bandwidth] = @Bandwidth, [NamaNAS] = @NamaNAS, [IPWAN] = @IPWAN, [IPNAS] = @IPNAS, [JumlahPC] = @JumlahPC, [JumlahNotebook] = @JumlahNotebook, [JumlahTC] = @JumlahTC, [Date] = @Date, [PIC] = @PIC, [Telp] = @Telp, [HP] = @HP, [Engineer] = @Engineer, [SID] = @SID WHERE [ID]=@ID ";
		
		/// <remarks>This field represents the DELETE string for the table Data Cabang, with the WHERE clause.</remarks>
		internal static string _SQL_Delete = "DELETE FROM [dbo].[Data Cabang] WHERE [ID]=@ID ";
		#endregion
		
		#region Tables Members
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID;
		
		[DisplayName("ID")]
		[Category("Primary Key")]
		public System.Nullable<System.Guid> ID
		{
			get
			{
				try
				{
					return _ID;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID", err);
				}
			}
			set
			{
				try
				{
					_ID = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _wfStatus;
		
		[DisplayName("wf Status")]
		[Category("Column")]
		public string wfStatus
		{
			get
			{
				try
				{
					return _wfStatus;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting wfStatus", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_wfStatus = value;
					}
					else
					{
						throw new OverflowException("Error setting wfStatus, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting wfStatus", err);
				}
			}
		}
		
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID_Router;
		
		[DisplayName("ID_Router")]
		[Category("Foreign Key")]
		public System.Nullable<System.Guid> ID_Router
		{
			get
			{
				try
				{
					return _ID_Router;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_Router", err);
				}
			}
			set
			{
				try
				{
					_ID_Router = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_Router", err);
				}
			}
		}
		
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID_NAS;
		
		[DisplayName("ID_NAS")]
		[Category("Foreign Key")]
		public System.Nullable<System.Guid> ID_NAS
		{
			get
			{
				try
				{
					return _ID_NAS;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_NAS", err);
				}
			}
			set
			{
				try
				{
					_ID_NAS = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_NAS", err);
				}
			}
		}
		
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID_Provider;
		
		[DisplayName("ID_Provider")]
		[Category("Foreign Key")]
		public System.Nullable<System.Guid> ID_Provider
		{
			get
			{
				try
				{
					return _ID_Provider;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_Provider", err);
				}
			}
			set
			{
				try
				{
					_ID_Provider = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_Provider", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _NamaCabang;
		
		[DisplayName("Nama Cabang")]
		[Category("Column")]
		public string NamaCabang
		{
			get
			{
				try
				{
					return _NamaCabang;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting NamaCabang", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_NamaCabang = value;
					}
					else
					{
						throw new OverflowException("Error setting NamaCabang, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting NamaCabang", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _KodeCabang;
		
		[DisplayName("Kode Cabang")]
		[Category("Column")]
		public string KodeCabang
		{
			get
			{
				try
				{
					return _KodeCabang;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting KodeCabang", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 100))
					{
						_KodeCabang = value;
					}
					else
					{
						throw new OverflowException("Error setting KodeCabang, Length of value is to long. Maximum Length: 100");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting KodeCabang", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _NamaLokasi;
		
		[DisplayName("Nama Lokasi")]
		[Category("Column")]
		public string NamaLokasi
		{
			get
			{
				try
				{
					return _NamaLokasi;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting NamaLokasi", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_NamaLokasi = value;
					}
					else
					{
						throw new OverflowException("Error setting NamaLokasi, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting NamaLokasi", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _Alamat;
		
		[DisplayName("Alamat")]
		[Category("Column")]
		public string Alamat
		{
			get
			{
				try
				{
					return _Alamat;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Alamat", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_Alamat = value;
					}
					else
					{
						throw new OverflowException("Error setting Alamat, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Alamat", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _SerialNumber;
		
		[DisplayName("Serial Number")]
		[Category("Column")]
		public string SerialNumber
		{
			get
			{
				try
				{
					return _SerialNumber;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting SerialNumber", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_SerialNumber = value;
					}
					else
					{
						throw new OverflowException("Error setting SerialNumber, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting SerialNumber", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _IPLAN;
		
		[DisplayName("IPLAN")]
		[Category("Column")]
		public string IPLAN
		{
			get
			{
				try
				{
					return _IPLAN;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting IPLAN", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_IPLAN = value;
					}
					else
					{
						throw new OverflowException("Error setting IPLAN, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting IPLAN", err);
				}
			}
		}
		
		/// <remarks>SQL Type:int - </remarks>
		private System.Nullable<int> _Bandwidth;
		
		[DisplayName("Bandwidth")]
		[Category("Column")]
		public System.Nullable<int> Bandwidth
		{
			get
			{
				try
				{
					return _Bandwidth;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Bandwidth", err);
				}
			}
			set
			{
				try
				{
					_Bandwidth = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Bandwidth", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _NamaNAS;
		
		[DisplayName("Nama NAS")]
		[Category("Column")]
		public string NamaNAS
		{
			get
			{
				try
				{
					return _NamaNAS;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting NamaNAS", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_NamaNAS = value;
					}
					else
					{
						throw new OverflowException("Error setting NamaNAS, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting NamaNAS", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _IPWAN;
		
		[DisplayName("IPWAN")]
		[Category("Column")]
		public string IPWAN
		{
			get
			{
				try
				{
					return _IPWAN;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting IPWAN", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_IPWAN = value;
					}
					else
					{
						throw new OverflowException("Error setting IPWAN, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting IPWAN", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _IPNAS;
		
		[DisplayName("IPNAS")]
		[Category("Column")]
		public string IPNAS
		{
			get
			{
				try
				{
					return _IPNAS;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting IPNAS", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_IPNAS = value;
					}
					else
					{
						throw new OverflowException("Error setting IPNAS, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting IPNAS", err);
				}
			}
		}
		
		/// <remarks>SQL Type:int - </remarks>
		private System.Nullable<int> _JumlahPC;
		
		[DisplayName("Jumlah PC")]
		[Category("Column")]
		public System.Nullable<int> JumlahPC
		{
			get
			{
				try
				{
					return _JumlahPC;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting JumlahPC", err);
				}
			}
			set
			{
				try
				{
					_JumlahPC = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting JumlahPC", err);
				}
			}
		}
		
		/// <remarks>SQL Type:int - </remarks>
		private System.Nullable<int> _JumlahNotebook;
		
		[DisplayName("Jumlah Notebook")]
		[Category("Column")]
		public System.Nullable<int> JumlahNotebook
		{
			get
			{
				try
				{
					return _JumlahNotebook;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting JumlahNotebook", err);
				}
			}
			set
			{
				try
				{
					_JumlahNotebook = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting JumlahNotebook", err);
				}
			}
		}
		
		/// <remarks>SQL Type:int - </remarks>
		private System.Nullable<int> _JumlahTC;
		
		[DisplayName("Jumlah TC")]
		[Category("Column")]
		public System.Nullable<int> JumlahTC
		{
			get
			{
				try
				{
					return _JumlahTC;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting JumlahTC", err);
				}
			}
			set
			{
				try
				{
					_JumlahTC = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting JumlahTC", err);
				}
			}
		}
		
		/// <remarks>SQL Type:datetime - </remarks>
		private System.Nullable<System.DateTime> _Date;
		
		[DisplayName("Date")]
		[Category("Column")]
		public System.Nullable<System.DateTime> Date
		{
			get
			{
				try
				{
					return _Date;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Date", err);
				}
			}
			set
			{
				try
				{
					_Date = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Date", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _PIC;
		
		[DisplayName("PIC")]
		[Category("Column")]
		public string PIC
		{
			get
			{
				try
				{
					return _PIC;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting PIC", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_PIC = value;
					}
					else
					{
						throw new OverflowException("Error setting PIC, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting PIC", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _Telp;
		
		[DisplayName("Telp")]
		[Category("Column")]
		public string Telp
		{
			get
			{
				try
				{
					return _Telp;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Telp", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_Telp = value;
					}
					else
					{
						throw new OverflowException("Error setting Telp, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Telp", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _HP;
		
		[DisplayName("HP")]
		[Category("Column")]
		public string HP
		{
			get
			{
				try
				{
					return _HP;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting HP", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_HP = value;
					}
					else
					{
						throw new OverflowException("Error setting HP, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting HP", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _Engineer;
		
		[DisplayName("Engineer")]
		[Category("Column")]
		public string Engineer
		{
			get
			{
				try
				{
					return _Engineer;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Engineer", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_Engineer = value;
					}
					else
					{
						throw new OverflowException("Error setting Engineer, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Engineer", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _SID;
		
		[DisplayName("SID")]
		[Category("Column")]
		public string SID
		{
			get
			{
				try
				{
					return _SID;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting SID", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_SID = value;
					}
					else
					{
						throw new OverflowException("Error setting SID, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting SID", err);
				}
			}
		}
		#endregion
		
		#region Related Objects
		/// <remarks>Represents the foreign key object</remarks>
		private NAS _ID_NAS_NAS;
		
		[Description("Represents the foreign key object of the type NAS")]
		public NAS ID_NAS_NAS
		{
			get
			{
				try
				{
					return _ID_NAS_NAS;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_NAS_NAS", err);
				}
			}
			set
			{
				try
				{
					_ID_NAS_NAS = value;
					_ID_NAS = _ID_NAS_NAS.ID;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_NAS_NAS", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Provider _ID_Provider_Provider;
		
		[Description("Represents the foreign key object of the type Provider")]
		public Provider ID_Provider_Provider
		{
			get
			{
				try
				{
					return _ID_Provider_Provider;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_Provider_Provider", err);
				}
			}
			set
			{
				try
				{
					_ID_Provider_Provider = value;
					_ID_Provider = _ID_Provider_Provider.ID;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_Provider_Provider", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Router _ID_Router_Router;
		
		[Description("Represents the foreign key object of the type Router")]
		public Router ID_Router_Router
		{
			get
			{
				try
				{
					return _ID_Router_Router;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_Router_Router", err);
				}
			}
			set
			{
				try
				{
					_ID_Router_Router = value;
					_ID_Router = _ID_Router_Router.ID;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_Router_Router", err);
				}
			}
		}

        /// <remarks>SQL Type:varchar - </remarks>
        private string _Lokasi;

        [DisplayName("Lokasi")]
        [Category("Column")]
        public string Lokasi
        {
            get
            {
                try
                {
                    return _Lokasi;
                }
                catch (System.Exception err)
                {
                    throw new Exception("Error getting Lokasi", err);
                }
            }
            set
            {
                try
                {
                    _Lokasi = value;
                }
                catch (System.Exception err)
                {
                    throw new Exception("Error setting Lokasi", err);
                }
            }
        }
		#endregion
		
		#region Related Object Collections
		/// <remarks>Represents the foreign key object</remarks>
		private Data_KunjunganCollection _Data_KunjunganCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Data_Cabang.")]
		public Data_KunjunganCollection Data_KunjunganCollection
		{
			get
			{
				try
				{
					return _Data_KunjunganCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Data_KunjunganCollection", err);
				}
			}
			set
			{
				try
				{
					_Data_KunjunganCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Data_KunjunganCollection", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Detail_PrinterCollection _Detail_PrinterCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Data_Cabang.")]
		public Detail_PrinterCollection Detail_PrinterCollection
		{
			get
			{
				try
				{
					return _Detail_PrinterCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Detail_PrinterCollection", err);
				}
			}
			set
			{
				try
				{
					_Detail_PrinterCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Detail_PrinterCollection", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Inventory_NetworkCollection _Inventory_NetworkCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Data_Cabang.")]
		public Inventory_NetworkCollection Inventory_NetworkCollection
		{
			get
			{
				try
				{
					return _Inventory_NetworkCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Inventory_NetworkCollection", err);
				}
			}
			set
			{
				try
				{
					_Inventory_NetworkCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Inventory_NetworkCollection", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Inventory_PhysicalCollection _Inventory_PhysicalCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Data_Cabang.")]
		public Inventory_PhysicalCollection Inventory_PhysicalCollection
		{
			get
			{
				try
				{
					return _Inventory_PhysicalCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Inventory_PhysicalCollection", err);
				}
			}
			set
			{
				try
				{
					_Inventory_PhysicalCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Inventory_PhysicalCollection", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Inventory_StorageCollection _Inventory_StorageCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Data_Cabang.")]
		public Inventory_StorageCollection Inventory_StorageCollection
		{
			get
			{
				try
				{
					return _Inventory_StorageCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Inventory_StorageCollection", err);
				}
			}
			set
			{
				try
				{
					_Inventory_StorageCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Inventory_StorageCollection", err);
				}
			}
		}
		
		/// <remarks>Represents the foreign key object</remarks>
		private Inventory_VMCollection _Inventory_VMCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Data_Cabang.")]
		public Inventory_VMCollection Inventory_VMCollection
		{
			get
			{
				try
				{
					return _Inventory_VMCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Inventory_VMCollection", err);
				}
			}
			set
			{
				try
				{
					_Inventory_VMCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Inventory_VMCollection", err);
				}
			}
		}
		#endregion
		
		#region Public Methods
		public void Select()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Data_Cabang._SQL_Select;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				SqlDataReader rs = Com.ExecuteReader();
				while(rs.Read())
				{
					AddFromRecordSet(rs);
				}
				rs.Close();
				Conn.Close();
				rs.Dispose();
				Com.Dispose();
				Conn.Dispose();
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public System.Data.DataTable SelectByParam()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Data_Cabang._SQL_SelectByParam;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				SqlDataAdapter objDataAdapter = new SqlDataAdapter(Com);
				DataTable objDataTable = new DataTable();
				objDataAdapter.Fill(objDataTable);
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return objDataTable;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public int Insert()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Data_Cabang._SQL_Insert;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				int rowseffected = Com.ExecuteNonQuery();
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return rowseffected;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public int Update()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Data_Cabang._SQL_Update;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				int rowseffected = Com.ExecuteNonQuery();
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return rowseffected;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public int Delete()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Data_Cabang._SQL_Delete;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				int rowseffected = Com.ExecuteNonQuery();
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return rowseffected;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public string[] GetSqlCommandStrings()
		{
			try
			{
				string[] CommStr = new string[4];
				CommStr[0] = "SELECT [ID], [wfStatus], [ID_Router], [ID_NAS], [ID_Provider], [NamaCabang], [KodeCabang], [NamaLokasi], [Alamat], [SerialNumber], [IPLAN], [Bandwidth], [NamaNAS], [IPWAN], [IPNAS], [JumlahPC], [JumlahNotebook], [JumlahTC], [Date], [PIC], [Telp], [HP], [Engineer], [SID] FROM [dbo].[Data Cabang] WHERE [ID] = " + _ID + "";
				CommStr[1] = "INSERT INTO [dbo].[Data Cabang] ([ID], [wfStatus], [ID_Router], [ID_NAS], [ID_Provider], [NamaCabang], [KodeCabang], [NamaLokasi], [Alamat], [SerialNumber], [IPLAN], [Bandwidth], [NamaNAS], [IPWAN], [IPNAS], [JumlahPC], [JumlahNotebook], [JumlahTC], [Date], [PIC], [Telp], [HP], [Engineer], [SID]) VALUES(" + _ID + ", '" + _wfStatus.Replace("'","''") + "', " + _ID_Router + ", " + _ID_NAS + ", " + _ID_Provider + ", '" + _NamaCabang.Replace("'","''") + "', '" + _KodeCabang.Replace("'","''") + "', '" + _NamaLokasi.Replace("'","''") + "', '" + _Alamat.Replace("'","''") + "', '" + _SerialNumber.Replace("'","''") + "', '" + _IPLAN.Replace("'","''") + "', " + _Bandwidth + ", '" + _NamaNAS.Replace("'","''") + "', '" + _IPWAN.Replace("'","''") + "', '" + _IPNAS.Replace("'","''") + "', " + _JumlahPC + ", " + _JumlahNotebook + ", " + _JumlahTC + ", '" + _Date + "', '" + _PIC.Replace("'","''") + "', '" + _Telp.Replace("'","''") + "', '" + _HP.Replace("'","''") + "', '" + _Engineer.Replace("'","''") + "', '" + _SID.Replace("'","''") + "')";
				CommStr[2] = "UPDATE [dbo].[Data Cabang] SET [wfStatus] = '" + _wfStatus.Replace("'","''") + "' ,[ID_Router] = " + _ID_Router + " ,[ID_NAS] = " + _ID_NAS + " ,[ID_Provider] = " + _ID_Provider + " ,[NamaCabang] = '" + _NamaCabang.Replace("'","''") + "' ,[KodeCabang] = '" + _KodeCabang.Replace("'","''") + "' ,[NamaLokasi] = '" + _NamaLokasi.Replace("'","''") + "' ,[Alamat] = '" + _Alamat.Replace("'","''") + "' ,[SerialNumber] = '" + _SerialNumber.Replace("'","''") + "' ,[IPLAN] = '" + _IPLAN.Replace("'","''") + "' ,[Bandwidth] = " + _Bandwidth + " ,[NamaNAS] = '" + _NamaNAS.Replace("'","''") + "' ,[IPWAN] = '" + _IPWAN.Replace("'","''") + "' ,[IPNAS] = '" + _IPNAS.Replace("'","''") + "' ,[JumlahPC] = " + _JumlahPC + " ,[JumlahNotebook] = " + _JumlahNotebook + " ,[JumlahTC] = " + _JumlahTC + " ,[Date] = '" + _Date + "' ,[PIC] = '" + _PIC.Replace("'","''") + "' ,[Telp] = '" + _Telp.Replace("'","''") + "' ,[HP] = '" + _HP.Replace("'","''") + "' ,[Engineer] = '" + _Engineer.Replace("'","''") + "' ,[SID] = '" + _SID.Replace("'","''") + "' WHERE [ID] = " + _ID + "";
				CommStr[3] = "DELETE FROM [dbo].[Data Cabang] WHERE [ID] = " + _ID + "";
				return CommStr;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		#endregion
		
		#region Private Methods
		private void AddFromRecordSet(SqlDataReader rs)
		{
			try
			{
				// if value from the recordset, to the ID field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID")) == false))
				{
					ID = rs.GetGuid(rs.GetOrdinal("ID"));
				}
				// if value from the recordset, to the wfStatus field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("wfStatus")) == false))
				{
					wfStatus = rs.GetString(rs.GetOrdinal("wfStatus"));
				}
				// if value from the recordset, to the ID_Router field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID_Router")) == false))
				{
					ID_Router = rs.GetGuid(rs.GetOrdinal("ID_Router"));
				}
				// if value from the recordset, to the ID_NAS field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID_NAS")) == false))
				{
					ID_NAS = rs.GetGuid(rs.GetOrdinal("ID_NAS"));
				}
				// if value from the recordset, to the ID_Provider field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID_Provider")) == false))
				{
					ID_Provider = rs.GetGuid(rs.GetOrdinal("ID_Provider"));
				}
				// if value from the recordset, to the NamaCabang field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("NamaCabang")) == false))
				{
					NamaCabang = rs.GetString(rs.GetOrdinal("NamaCabang"));
				}
				// if value from the recordset, to the KodeCabang field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("KodeCabang")) == false))
				{
					KodeCabang = rs.GetString(rs.GetOrdinal("KodeCabang"));
				}
				// if value from the recordset, to the NamaLokasi field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("NamaLokasi")) == false))
				{
					NamaLokasi = rs.GetString(rs.GetOrdinal("NamaLokasi"));
				}
				// if value from the recordset, to the Alamat field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Alamat")) == false))
				{
					Alamat = rs.GetString(rs.GetOrdinal("Alamat"));
				}
				// if value from the recordset, to the SerialNumber field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("SerialNumber")) == false))
				{
					SerialNumber = rs.GetString(rs.GetOrdinal("SerialNumber"));
				}
				// if value from the recordset, to the IPLAN field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("IPLAN")) == false))
				{
					IPLAN = rs.GetString(rs.GetOrdinal("IPLAN"));
				}
				// if value from the recordset, to the Bandwidth field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Bandwidth")) == false))
				{
					Bandwidth = rs.GetInt32(rs.GetOrdinal("Bandwidth"));
				}
				// if value from the recordset, to the NamaNAS field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("NamaNAS")) == false))
				{
					NamaNAS = rs.GetString(rs.GetOrdinal("NamaNAS"));
				}
				// if value from the recordset, to the IPWAN field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("IPWAN")) == false))
				{
					IPWAN = rs.GetString(rs.GetOrdinal("IPWAN"));
				}
				// if value from the recordset, to the IPNAS field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("IPNAS")) == false))
				{
					IPNAS = rs.GetString(rs.GetOrdinal("IPNAS"));
				}
				// if value from the recordset, to the JumlahPC field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("JumlahPC")) == false))
				{
					JumlahPC = rs.GetInt32(rs.GetOrdinal("JumlahPC"));
				}
				// if value from the recordset, to the JumlahNotebook field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("JumlahNotebook")) == false))
				{
					JumlahNotebook = rs.GetInt32(rs.GetOrdinal("JumlahNotebook"));
				}
				// if value from the recordset, to the JumlahTC field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("JumlahTC")) == false))
				{
					JumlahTC = rs.GetInt32(rs.GetOrdinal("JumlahTC"));
				}
				// if value from the recordset, to the Date field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Date")) == false))
				{
					Date = rs.GetDateTime(rs.GetOrdinal("Date"));
				}
				// if value from the recordset, to the PIC field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("PIC")) == false))
				{
					PIC = rs.GetString(rs.GetOrdinal("PIC"));
				}
				// if value from the recordset, to the Telp field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Telp")) == false))
				{
					Telp = rs.GetString(rs.GetOrdinal("Telp"));
				}
				// if value from the recordset, to the HP field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("HP")) == false))
				{
					HP = rs.GetString(rs.GetOrdinal("HP"));
				}
				// if value from the recordset, to the Engineer field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Engineer")) == false))
				{
					Engineer = rs.GetString(rs.GetOrdinal("Engineer"));
				}
				// if value from the recordset, to the SID field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("SID")) == false))
				{
					SID = rs.GetString(rs.GetOrdinal("SID"));
				}
                // if value from the recordset, to the Engineer field is NOT null then set the value.
                if ((rs.IsDBNull(rs.GetOrdinal("Lokasi")) == false))
                {
                    Lokasi = rs.GetString(rs.GetOrdinal("Lokasi"));
                }
			}
			catch (SqlException sqlExc)
			{
				throw sqlExc;
			}
			catch (Exception Exc)
			{
				throw Exc;
			}
		}
		
		private SqlParameter[] GetSqlParameters()
		{
			List<SqlParameter> SqlParmColl = new List<SqlParameter>();
			try
			{
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID", ID, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@wfStatus", wfStatus, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID_Router", ID_Router, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID_NAS", ID_NAS, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID_Provider", ID_Provider, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@NamaCabang", NamaCabang, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@KodeCabang", KodeCabang, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@NamaLokasi", NamaLokasi, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Alamat", Alamat, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@SerialNumber", SerialNumber, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@IPLAN", IPLAN, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Bandwidth", Bandwidth, SqlDbType.Int));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@NamaNAS", NamaNAS, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@IPWAN", IPWAN, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@IPNAS", IPNAS, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@JumlahPC", JumlahPC, SqlDbType.Int));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@JumlahNotebook", JumlahNotebook, SqlDbType.Int));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@JumlahTC", JumlahTC, SqlDbType.Int));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Date", Date, SqlDbType.DateTime));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@PIC", PIC, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Telp", Telp, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@HP", HP, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Engineer", Engineer, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@SID", SID, SqlDbType.VarChar));
				return SqlParmColl.ToArray();
			}
			catch (Exception Exc)
			{
				throw Exc;
			}
		}
		#endregion
	}
	
	public class Data_CabangCollection : System.Collections.CollectionBase
	{
		
		[Description("Adds a new Data_Cabang to the collection.")]
		public int Add(Data_Cabang item)
		{
			int newindex = List.Add(item);
			return newindex;
		}
		
		[Description("Removes a Data_Cabang from the collection.")]
		public void Remove(Data_Cabang item)
		{
			List.Remove(item);
		}
		
		[Description("Inserts an Data_Cabang into the collection at the specified index.")]
		public void Insert(int index, Data_Cabang item)
		{
			List.Insert(index, item);
		}
		
		[Description("Returns the index value of the Data_Cabang class in the collection.")]
		public int IndexOf(Data_Cabang item)
		{
			return List.IndexOf(item);
		}
		
		[Description("Returns true if the Data_Cabang class is present in the collection.")]
		public bool Contains(Data_Cabang item)
		{
			return List.Contains(item);
		}
	}
	
	public enum Data_Cabang_Fields
	{
		
		ID,
		
		wfStatus,
		
		ID_Router,
		
		ID_NAS,
		
		ID_Provider,
		
		NamaCabang,
		
		KodeCabang,
		
		NamaLokasi,
		
		Alamat,
		
		SerialNumber,
		
		IPLAN,
		
		Bandwidth,
		
		NamaNAS,
		
		IPWAN,
		
		IPNAS,
		
		JumlahPC,
		
		JumlahNotebook,
		
		JumlahTC,
		
		Date,
		
		PIC,
		
		Telp,
		
		HP,
		
		Engineer,
		
		SID,

        Lokasi,
	}
}
